#include "KinectInterface.h"

KinectInterface::KinectInterface(){
    device = &freenect.createDevice(0);
    running = false;

}


KinectInterface::~KinectInterface(){


}

/** @brief Start retrieval of video and depth data
*   @param
*   @return
*
* Makes a call to the start functions of the device
*
*/
void KinectInterface::run(){
    if(!running){
        device->startVideo();
        device->startDepth();
        running = true;
    }
}

/** @brief Get RGB data
*   @param Mat &mat
*   @return
*
* Stores current video frame in refererence variable
*
*/
void KinectInterface::getRgbFrame(Mat &mat){
    device->getVideo(mat);
}

/** @brief Get depth data
*   @param Mat &mat
*   @return
*
* Stores current depth frame in refererence variable
*
*/
void KinectInterface::getDepthFrame(Mat &mat){
    device->getDepth(mat);
}

/** @brief Stop retrieval of video and depth data
*   @param
*   @return
*
* Makes a call to the stop functions of the device
*/
void KinectInterface::stop(){
    if(running){
        device->stopVideo();
        device->stopDepth();
        running = false;
    }
}
